package com.bdqn.t350.service;

import com.bdqn.t350.dao.UserDao;
import com.bdqn.t350.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

//@Component("UserService1111")
//@Controller
//@Repository
@Service("UserService1111")
public class UserServiceImp implements UserService {

    //默认按照bean的名称先去容器中找,在按照类型去匹配
    //@Resource(name = "userDao")
    //默认按照bean的类型先去容器中找，它也可以指定名称匹配
    @Autowired
    @Qualifier("userDao1")
    UserDao userDao2;

    public UserDao getUserDao2() {
        return userDao2;
    }

    public void setUserDao2(UserDao userDao2) {
        this.userDao2 = userDao2;
    }

    @Override
    public void saveService(User user) {
        userDao2.save(user);
    }
}
